package com.climber.android.commonres.widget.loading

import android.content.Context
import android.text.TextUtils
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import com.climber.android.commonres.R

/**
 * Created by Mikes at 2020-05-21 11:49
 */
class CommonBigLoadingView : LinearLayout {
    private lateinit var loadingLabel: TextView

    constructor(context: Context) : super(context) {
        init()
    }

    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
        init()
    }

    constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
        init()
    }

    private fun init() {
        View.inflate(context, R.layout.com_view_big_loading, this)

        loadingLabel = findViewById<View>(R.id.loadingLabel) as TextView

        updateData()
    }

    private fun updateData() {
        configure("")
    }

    fun configure(loadingContent: String?) {
        if (!TextUtils.isEmpty(loadingContent)) {
            this.loadingLabel.text = loadingContent
        }
    }
}